package com.linewell.dao.impl;

import com.linewell.dao.LetterMapper;
import com.linewell.entity.Article;
import com.linewell.entity.Letter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class LetterDao implements LetterMapper {

    @Autowired
    LetterMapper letterMapper;
    /**
     * @descripition  插入留言信息
     * @author hyuhuang@linewell.com
     * @date 2018/2/27 12:50
     * @param letter
     * @return int
     */
    public int insertLetter(Letter letter) {
        return letterMapper.insertLetter(letter);
    }

    public List<Letter> selectLetter(Long userId) {
        return letterMapper.selectLetter(userId);
    }

    public boolean updateLetterIsRead(String letterId) {
        return letterMapper.updateLetterIsRead(letterId);
    }

    public List<Letter> getLetterById(String letterId) {
        return letterMapper.getLetterById(letterId);
    }

    public String getUserByletterId(String letterId) {
        return letterMapper.getUserByletterId(letterId);
    }

    public boolean opinion(Letter letter) {
        return letterMapper.opinion(letter);
    }

    public List<Letter> selectSystemLetter(Long userId) {
        return letterMapper.selectSystemLetter(userId);
    }

    public Article getArticleByLetterId(String letterId) {
        return letterMapper.getArticleByLetterId(letterId);
    }

    public void deleteLetterByArticle(Long articleId) {
         letterMapper.deleteLetterByArticle(articleId);
    }
}
